import { ViewModels } from "../constants/view_model";
import { TextModel, SelectionModel } from "../models";
import DivisionView from "./division_view";
import SourceView from "./source_view";

export class ViewProvider {
  provide (viewMode: ViewModels, textModel: TextModel, selectionModel: SelectionModel, viewContainer: HTMLElement) {
    switch (viewMode) {
      case ViewModels.source:
        return new SourceView(textModel, selectionModel, viewContainer);
      case ViewModels.division:
        return new DivisionView(textModel, selectionModel, viewContainer);
      case ViewModels.render:
        return null;
      default:
        return new SourceView(textModel, selectionModel, viewContainer);
    }
  }
}

export default ViewProvider